/**
 * Created By zhangQ 2018/3/5
 * 1.需求管理
 */
import axiosUtils from '@api/env/axiosEnv'

let customAxios = axiosUtils._initAxios()

export function getDemandList (param) {
  return customAxios({
    url: '/main/demand/getDemandList',
    method: 'post',
    data: {
      type: param.type,
      page: param.page,
      pageSize: 10
    }
  })
}

export function addDemand (param) {
  return customAxios({
    url: '/main/demand/addDemand',
    method: 'post',
    data: {
      type: param.type,
      demandNumber: param.demandNumber,
      sellerName: param.sellerName,
      productName: param.productName,
      needTime: param.needTime
    }
  })
}

export function getMineCompanyList () {
  return customAxios({
    url: '/main/demand/getMineCompanyList',
    method: 'post'
  })
}

export function deleteDemand (id) {
  return customAxios({
    url: '/main/demand/deleteDemand',
    method: 'post',
    data: {
      id: id
    }
  })
}

export function editDemand (param) {
  return customAxios({
    url: '/main/demand/editDemand',
    method: 'post',
    data: {
      id: param.id,
      type: param.type,
      demandNumber: param.demandNumber,
      sellerName: param.sellerName,
      productName: param.productName,
      needTime: param.needTime
    }
  })
}

export function rejectRequirementsList (param) {
  return customAxios({
    url: '/main/demand/confirmDemand',
    method: 'post',
    data: {
      id: param.id,
      status: param.status,
      content: param.content
    }
  })
}

export function agreeRequirementsList (param) {
  return customAxios({
    url: '/main/demand/confirmDemand',
    method: 'post',
    data: {
      id: param.id,
      status: param.status
    }
  })
}
